package gagak.framework.web.support.request;

import com.g5.framework.web.context.request.AbstractRequestAttributes;
import com.g5.framework.web.utils.Assert;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/*
 * @program: ce
 * @description: 请求熟悉
 * @author: houhong
 * @create: 2022-11-23 17:15
 */
public class ServletRequestAttributes extends AbstractRequestAttributes {


    private final HttpServletRequest request;


    private HttpServletResponse response;


    private volatile HttpSession session;

    private final Map<String, Object> sessionAttributesToUpdate = new ConcurrentHashMap<String, Object>(1);


    public ServletRequestAttributes(HttpServletRequest request) {
        Assert.notNull(request, "Request must not be null");
        this.request = request;
    }

    public ServletRequestAttributes(HttpServletRequest request, HttpServletResponse response) {
        this(request);
        this.response = response;
    }

    public final HttpServletRequest getRequest() {
        return this.request;
    }


    public final HttpServletResponse getResponse() {
        return this.response;
    }


    @Override
    protected void updateAccessedSessionAttributes() {

    }
}